<template>
<section class="pingjia">
	
	<el-form ref="form1" :model="form1" label-width="80px">
		<p v-if="pingjiaType==='shenqing'||pingjiaType==='fankui'" style="font-size: 20px;margin-bottom: 10px;">对分发人员评分</p>
		<p v-if="pingjiaType==='shenqing'||pingjiaType==='fankui'">
			<el-rate
			  v-model="form1.start"
			  show-text
			  :texts="['差评','中评','好评']"
			  :max = "3"
			  >
			</el-rate>
		</p>	
		 <el-form-item label="工单评价:" v-if="pingjiaType==='shenqing'||pingjiaType==='fankui'">
		    <el-input type="textarea" :maxlength=500 v-model="form1.desc"></el-input>
		 </el-form-item>
		 
		<!--<div class="" style="text-align: center;">
			<el-button type="primary" @click="pingSubimt">提交</el-button>
		</div>-->
		
		<!--****************************************************************************************************-->
		<p v-if="pingjiaType==='shenqing'||pingjiaType==='fenfa'" style="font-size: 20px;">对协同人员评分</p>
		<p v-if="pingjiaType==='shenqing'||pingjiaType==='fenfa'" >
			<el-rate
			  v-model="form2.start"
			  show-text
			  :texts="['差评','中评','好评']"
			  :max = "3"
			  >
			</el-rate>
		</p>	
		 <el-form-item label="工单评价:" v-if="pingjiaType==='shenqing'||pingjiaType==='fenfa'" >
		    <el-input type="textarea" :maxlength=500 v-model="form2.desc"></el-input>
		 </el-form-item>
		 
		<div class="" style="text-align: center;" v-if="pingjiaType==='shenqing'||pingjiaType==='fenfa'||pingjiaType==='fankui'">
			<el-button type="primary" @click="pingSubimt">提交</el-button>
		</div>
		<p v-if="pingjiaType!='shenqing'&&pingjiaType!='fenfa'&&pingjiaType!='fankui'">{{pingjiaType}}</p>
	</el-form>
</section>
</template>

<script>
	import {apiPostPingJia} from '../css_img_js/xieTongApi'
	export default{
		props:{
			pingjiaType:null,
			processInstanceId:null,
		},
		data(){
			return {
				form1:{
					desc:'',
					start:0,
				},
				form2:{
					desc:'',
					start:0,
				},
			}
		},
		methods:{
			pingSubimt(){/*提交评价*/
				console.log(this.form1,this.form2);
				apiPostPingJia(this,this.form1,this.form2,this.processInstanceId,this.pingjiaType);
			}
		},
		mounted(){
			if(this.processInstanceId!=null&&this.pingjiaType!=null){
				console.log(this.processInstanceId);
			}
		},
		watch:{
			  processInstanceId(newVal, oldVal){/*不同id就刷新试图*/
				console.log(newVal);
				console.log(oldVal);
				this.form1.desc='';
				this.form1.start=0;
				this.form2.desc='';
				this.form2.start=0;
			  }
		}
	}

</script>

<style >
	.pingjia textarea.el-textarea__inner{
		height: 220px;
	}
	.pingjia p{
		text-align: center;
  		 margin-bottom: 25px;
	}
	 .pingjia .el-rate__icon{
	 	font-size: 25px;
	 }
</style>